using System;
using System.Collections.Generic;
using System.Drawing;
using Microsoft.DirectX;

namespace RPGOnline.Controls.Map.Layers
{
    public class ObstructionLine
    {
        private List<Point> m_points = new List<Point>();
        public List<Point> Points { get { return m_points; } }

        public ObstructionEdge[] GetEdges(int offsetX, int offsetY)
        {
            List<ObstructionEdge> obstructionEdges = new List<ObstructionEdge>();
            if(m_points.Count > 1)
            {
                for (int i = 1; i < m_points.Count; i++)
                {
                    obstructionEdges.Add(
                        new ObstructionEdge(
                            Point.Add(m_points[i - 1], new Size(offsetX, offsetY)), 
                            Point.Add(m_points[i], new Size(offsetX, offsetY))
                        )
                    );
                }
            }
            return obstructionEdges.ToArray();
        }

        public void AddPoint(Point point)
        {
            m_points.Add(point);
        }
    }
}